package BST;

/**
 * 二叉查找树
 *
 * @author Lwh
 * @time 2022/11/11 01:14
 */
public class BsTreeNode<T extends Comparable<T>> {
    /*关键字（键值）*/
    T nodeKey;

    /*左节点引用*/
    BsTreeNode<T> left;

    /*右节点引用*/
    BsTreeNode<T> right;

    /*父节点引用，进行节点删除的时候会用到*/
    BsTreeNode<T> parent;

    public BsTreeNode<T> getParent() {
        return this.parent;
    }

    public BsTreeNode<T> getLeft() {
        return this.left;
    }

    public BsTreeNode<T> getRight() {
        return this.right;
    }

    public T getValue() {
        return this.nodeKey;
    }

    public BsTreeNode(T value) {
        this.nodeKey = value;
    }

    public BsTreeNode() {
    }

    @Override
    public String toString() {
        return nodeKey.toString();
    }
}
